package com.zsw.rpc;

import feign.FeignException;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

/**
 * @author zhangsw
 */
@FeignClient(name = "account-service")
@Component
public interface AccountFeignClient {

    /**
     * 远程调用
     * @param userId
     * @param money
     * @return
     * @throws FeignException
     */
    @PostMapping(value = "/account/deduct")
    boolean deductAccountBalance(
            @RequestParam(value = "userId") Integer userId,
            @RequestParam(value = "money") BigDecimal money
    ) throws FeignException;

}
